/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jjrealestatevisitor;

import jjrealestatevisitor.structure.House;
import jjrealestatevisitor.structure.Room;
import jjrealestatevisitor.structure.RoomItem;
import jjrealestatevisitor.visitor.*;

/**
 *
 * @author jochemsiegel
 */
public class HouseSpecifications implements Visitor {
    private int nrRooms = 0;
    private int houseArea= 0;

    public void visit(House house) {
        System.out.print("Addres: ");
        System.out.print(house.getPostalCode());
        System.out.print(" " + house.getHouseNumber());
        System.out.println(" " + house.getHouseNumberExtension());
        System.out.println();
        System.out.println("Kamers:");
        System.out.println();
    }

    public void visit(Room room) {
        int area = room.getLength() * room.getWidth();
        System.out.print(room.getType());
        System.out.println(" " + area + " m2");
        nrRooms++;
        houseArea = houseArea + area;
    }

    public void visit(RoomItem roomItem) {
        System.out.println("Deze kamer heeft een " + roomItem.getType());
    }

    public void displayRooms() {
        System.out.println("Dit huis heeft " + nrRooms + " kamers");
        System.out.println();
        System.out.println();
    }

    public void displayArea() {
        System.out.println("Dit huis is" + houseArea + " m2, groot.");
    }

    public void clearState() {
        nrRooms = 0;
        houseArea= 0;
    }

}
